#include "ctrl.h"
SceCtrlData pad; 
int oldpad;
extern Exit;

void Ctrl_Menu(int * quit){
    sceCtrlPeekBufferPositive(&pad,1);
  extern selection_selector_bakup;
  extern selection_selector;
  extern play_status;
  extern selection_Status;
  
    if(pad.Buttons!=oldpad){
        if(pad.Buttons&PSP_CTRL_LEFT)
          selection_selector-=1;
        if(pad.Buttons&PSP_CTRL_RIGHT)
          selection_selector+=1;
        if(pad.Buttons&PSP_CTRL_UP)
          selection_selector-=3;
        if(pad.Buttons&PSP_CTRL_DOWN)
          selection_selector+=3;
        if(pad.Buttons&PSP_CTRL_NOTE)
            ScreenShot("SCREENSHOT.PNG");
        if(pad.Buttons&PSP_CTRL_CIRCLE){
            switch(selection_selector){
              case 1:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=1;
                break;
              case 2:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=2;
                break;
              case 3:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=3;
                break;
              case 4:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=4;
                break;
              case 5:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=5;
                break;
              case 6:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=6;
                break;
              case 7:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=7;
                break;
              case 8:
                selection_selector_bakup=selection_selector;
                selection_selector=1;
                selection_Status=8;
                break;
              case 9:
                selection_Status=9;
                Exit=0;
            }
            *quit=0;
        }
    }
    if(selection_selector>9)selection_selector=1;
    if(selection_selector<1)selection_selector=9;
    oldpad=pad.Buttons;
}

void Ctrl_Playing(int *quit){
    sceCtrlPeekBufferPositive(&pad,1);
  extern selection_selector_bakup;
  extern selection_selector;
  extern play_status;
  extern selection_Status;
  
    if(pad.Buttons!=oldpad){
        if(pad.Buttons&PSP_CTRL_CROSS)
      *quit=0;
      selection_selector=selection_selector_bakup;
      selection_Status=0;
        if(pad.Buttons&PSP_CTRL_START)
      /*Play_PP()*/;
        if(pad.Buttons&PSP_CTRL_SQUARE){
      /*Music_Stop()*/;
      play_status=0;
        }
        if(pad.Buttons&PSP_CTRL_TRIANGLE);
        if(pad.Buttons&PSP_CTRL_SELECT);
        if(pad.Buttons&PSP_CTRL_LTRIGGER)
      /*Play_Next()*/;
        if(pad.Buttons&PSP_CTRL_RTRIGGER)
      /*Play_PREW()*/;
    }
    if(pad.Buttons&PSP_CTRL_LEFT)
    /*Music_SetPos(Music_GetPos()+5000000)*/;
    if(pad.Buttons&PSP_CTRL_RIGHT)
    /*Music_SetPos(Music_GetPos()-5000000)*/;
    oldpad=pad.Buttons;
}
